Current version: HDF 4.2r3
The Hierarchical Data Format (HDF) is a multi-object file format that facilitates the transfer of various types of data between machines and operating systems. HDF is a product of the National Center for Supercomputing Applications (NCSA). HDF is designed to be flexible, portable, self-describing and easily extensible for future enhancements or compatibility with other standard formats. The HDF library contains interfaces for storing and retrieving images and multi-dimensional scientific data.
IDL’s HDF routines all begin with the prefix "HDF_".
The following IDL commands should be used to create a new HDF file:
The routines used to add data to an HDF file vary based on the interface model being used:
Two example files that demonstrate the use of the HDF routines can be found in the examples/doc/sdf
subdirectory of the IDL distribution. The file hdf_info.pro
prints a summary of basic information about an HDF file. The file hdf_rdwr.pro
creates a new HDF file and then reads the information back from that file. Run these example procedures by entering hdf_info
or hdf_rdwr
at the IDL command prompt or view the files in an IDL Editor window by entering .EDIT hdf_info.pro
or .EDIT hdf_rdwr.pro
.
There are two basic interfaces to HDF files: the single-file application interface and the multiple-file application interface. These interfaces support eight different types (models) of data access. The table below lists the different models and the names of the IDL routines that access those models. Each model is described in more detail after the table.
Model |
IDL Routine Name Prefix |
---|---|
24-bit raster |
HDF_DF24_ |
annotation data |
HDF_DFAN_ |
palette data |
HDF_DFP_ |
8-bit raster |
HDF_DFR8_ |
scientific data |
HDF_SD_ |
multi-file scientific data |
HDF_SD_ |
VData |
HDF_VD_ |
VGroup |
HDF_VG_ |
In this mode, access is limited to one file at a time. This interface supports the 8-bit raster, 24-bit raster, palette, scientific data, and annotation models. The interfaces are described in more detail after the table.
The HDF_SD_ routines allow operations on more than one file at a time. This multi-file interoperability is achieved through HDF's use of a modified version of the NetCDF library. IDL’s interface to HDF’s multi-file capability is the HDF_SD_SETEXTFILE routine.
IDL’s HDF_SD_ routines can accept two different types of ID numbers. These ID numbers are referred to in the Help system as the SDinterface_id and SDdataset_id arguments.
The SDinterface_id is the Scientific Dataset interface ID. There is only one SDinterface_id per HDF file. For each actual dataset used, you will also need an SDdataset_id, which is the ID for the particular dataset.
Some routines, such as HDF_SD_ATTRFIND, accept either an SDinterface_id or an SDdataset_id. In these cases, the documentation refers to the ID as an SD_id, meaning that either type of ID is accepted.
HDF and IDL support many different data types. Many of the HDF routines allow you to perform a data type conversion on the fly by setting keywords such as FLOAT. When the data type desired is not explicitly specified, IDL uses the conversions shown in the following tables. Note that single-precision floating-point is the default data type and that the complex data type is not supported.
When writing IDL data to an HDF file, IDL data types are converted to the HDF data types shown in the following table:
IDL Data Type |
HDF Data Type |
---|---|
BYTE |
DFNT_UINT8 (IDL bytes are unsigned) |
INT |
DFNT_INT16 |
UINT |
DFNT_UINT16 |
LONG |
DFNT_INT32 |
ULONG |
DFNT_UINT32 |
FLOAT |
DFNT_FLOAT32 |
DOUBLE |
DFNT_DOUBLE |
STRING |
DFNT_CHAR8 |
When reading data from an HDF file, HDF data types are converted to the IDL data types shown in the following table:
HDF Data Type |
IDL Data Type |
---|---|
DFNT_CHAR8 |
STRING |
DFNT_UINT8 |
BYTE |
DFNT_INT16 |
INT |
DFNT_UINT16 |
UINT |
DFNT_INT32 |
LONG |
DFNT_UINT32 |
ULONG |
DFNT_INT64 |
LONG |
DFNT_UINT64 |
ULONG |
DFNT_FLOAT32 or DFNT_NONE |
FLOAT |
HDF type codes for the supported HDF data types are shown in the table below:
HDF Data Type |
Type Code |
---|---|
DFNT_UCHAR |
3 |
DFNT_CHAR |
4 |
DFNT_FLOAT32 |
5 |
DFNT_FLOAT64 |
6 |
DFNT_INT8 |
20 |
DFNT_UINT8 |
21 |
DFNT_INT16 |
22 |
DFNT_UINT16 |
23 |
DFNT_INT32 |
24 |
DFNT_UINT32 |
25 |
DFNT_INT64 |
26 |
DFNT_UINT64 |
27 |
The following table lists common HDF tag numbers and their meanings:
Tag Number |
Meaning |
---|---|
030 |
Version Identifier |
100 |
File Identifier |
101 |
File Description |
102 |
Tag Identifier |
103 |
Tag Description |
104 |
Data Identifier Label |
105 |
Data Identifier Annotation |
106 |
Number Type |
107 |
Machine Type |
200 |
Obsolete8-Bit Image Dimensions |
201 |
Obsolete8-Bit Palette |
202 |
Obsolete8-Bit Raster Image |
203 |
Obsolete8-Bit Image-Compressed |
204 |
Obsolete8-Bit Image-INCOMP Compressed |
300 |
RIG Image Dimension |
301 |
Raster Image Look Up Table (LUT) |
302 |
Raster Image |
303 |
Compressed Raster Image |
306 |
Raster Image Group (RIG) |
307 |
RIG LUT Dimension |
308 |
RIG Matte Dimension |
309 |
Raster Image Matte Data |
310 |
Raster Image Color Correction |
311 |
Raster Image Color Format |
312 |
Raster Image Aspect Ratio |
400 |
Composite Image Descriptor |
500 |
XY Position |
602 |
Vector Image - Tek4014 Stream |
603 |
Vector Image - Tek4105 Stream |
701 |
SD Dimension Record |
702 |
SD Data |
703 |
SD Scales |
704 |
SD Labels |
705 |
SD Units |
706 |
SD Formats |
707 |
SD Max/Min |
708 |
SD Coordinates |
710 |
SD Link |
720 |
SD Descriptor (NDG) |
731 |
SD Calibration Information |
732 |
SD Fill Value |
1962 |
Vdata Description |
1963 |
Vdata |
1965 |
Vgroup |